/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: Spinor driver Vendor Hooks
 */

#ifdef CONFIG_VENDOR_SPINOR_HOOKS
#undef TRACE_SYSTEM
#define TRACE_SYSTEM spinor

#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_SPINOR_HOOKS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_SPINOR_HOOKS_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>

struct spi_nor;
struct flash_info;

DECLARE_HOOK(vendor_spinor_erase_size,
	TP_PROTO(struct spi_nor *nor, unsigned int *size),
	TP_ARGS(nor, size));

DECLARE_HOOK(vendor_spi_nor_read_id,
	TP_PROTO(const struct flash_info **info),
	TP_ARGS(info));

DECLARE_HOOK(vendor_spi_nor_read_id_fixup,
	TP_PROTO(const unsigned char *id, int len, const struct flash_info **info),
	TP_ARGS(id, len, info));

DECLARE_HOOK(vendor_spi_nor_set_addr_width,
	TP_PROTO(struct spi_nor *nor),
	TP_ARGS(nor));

DECLARE_HOOK(vendor_spi_nor_parse_4bait,
	TP_PROTO(struct spi_nor *nor),
	TP_ARGS(nor));

DECLARE_HOOK(vendor_spi_nor_read_sfdp,
	TP_PROTO(struct spi_nor *nor, u32 addr, size_t len, void *buf, int *ret),
	TP_ARGS(nor, addr, len, buf, ret));
#endif
/* This part must be outside protection */

#include <trace/define_trace.h>

#else

#include <linux/tracepoint.h>
struct spi_nor;
struct flash_info;

DECLARE_EVENT_NOP(vendor_spinor_erase_size,
	TP_PROTO(struct spi_nor *nor, unsigned int *size),
	TP_ARGS(nor, size));

DECLARE_EVENT_NOP(vendor_spi_nor_read_id,
	TP_PROTO(const struct flash_info **info),
	TP_ARGS(info));

DECLARE_EVENT_NOP(vendor_spi_nor_read_id_fixup,
	TP_PROTO(const unsigned char *id, unsigned int len, const struct flash_info **info),
	TP_ARGS(id, len, info));

DECLARE_EVENT_NOP(vendor_spi_nor_set_addr_width,
	TP_PROTO(struct spi_nor *nor),
	TP_ARGS(nor));

DECLARE_EVENT_NOP(vendor_spi_nor_parse_4bait,
	TP_PROTO(struct spi_nor *nor),
	TP_ARGS(nor));

DECLARE_EVENT_NOP(vendor_spi_nor_read_sfdp,
	TP_PROTO(struct spi_nor *nor, u32 addr, size_t len, void *buf, int *ret),
	TP_ARGS(nor, addr, len, buf, ret));
#endif
